Charging method and device

ABSTRACT

Embodiments of this application provide a charging method. The method includes that a session management function determines, a data flow within a protocol data unit, PDU, session and a charging key corresponding to the data flow within the PDU session, wherein a plurality of user plane functions are involved in the PDU session. For each of the plurality of user plane functions, the session management function sends to an online charging system, a quota request for a charging key without available quota for the UPF.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of U.S. patent application Ser. No.16/728,870, filed on Dec. 27, 2019, which is a continuation ofInternational Application No. PCT/CN2018/083830, filed on Apr. 20, 2018,which claims priority to Chinese Patent Application No. 201710526104.Xfiled on Jun. 30, 2017. The disclosures of the aforementionedapplications are hereby incorporated by reference in their entireties.

TECHNICAL FIELD

This application relates to the communications field, and in particular,to a charging method and apparatus.

BACKGROUND

Currently, a basic mechanism of online charging is as follows. Acharging trigger function (CTF) applies for reserving a quota of arating group from an online charging system (OCS), the OCS grants aquota, and the CTF performs quota management, quota usage, and charginginformation collection, and when detecting that a charging reportingcondition (trigger condition) is satisfied, reports collected charginginformation to the charging system.

In a 4G network, a policy and charging enforcement function (PCEF) at agateway is a CTF. The PCEF determines a charging mode (online chargingor offline charging), a statistics collection method (traffic, duration,or the like), a rating group (referred to as a charging key in thisapplication), a reporting granularity, and the like according to acharging policy delivered by a policy and charging rules function(PCRF). A charging granularity includes service_identifier_level orrating_group_level. If the charging granularity is rating_group_level,the PCEF needs to report charging information for each rating group. Ifthe charging granularity is service_identifier_level, the PCEF needs toreport charging information for each rating group and each serviceidentifier.

Drastic increase of data traffic poses new challenges to mobilenetworks. To deal with the challenges, an evolved mobile data networkarchitecture that separates a control plane from a user plane appears.In the architecture, only control is performed on the control plane anddeployment may be centralized; and a data flow passes through the userplane and deployment is distributed. A user may access a nearby userplane, to reduce a network transmission distance of data and a networkdelay and improve network efficiency.

Currently, the network architecture that separates a control plane froma user plane is already extended in a₄G network, and charging can beimplemented to some extent in the network architecture that separates acontrol plane from a user plane. In the architecture, a ratio of aquantity of control planes to a quantity of user planes is 1:1. As shownin FIG. 1, a serving gateway-C, a PDN gateway-C, and a TDF-C are controlplanes, and a serving gateway-U, a PDN gateway-U, and a TDF-U are userplanes. A control plane is a charging trigger point and performs acharging trigger function, and a user plane is a charging collectionpoint and performs a charging collection function.

However, in a new-generation network architecture, to reduce a networkdelay and improve network efficiency in a movement process of a user,the user plane may be switched while the control plane remainsunchanged. In addition, a user may simultaneously use a local service(for example, an operator service such as making a call or sending anSMS message) and an external service (for example, Internet access). Toimprove access efficiency, the user may be simultaneously connected to aplurality of user planes, where each user plane processes a differentservice scenario. In this case, a same rating group exists on differentuser planes. In a current online credit control mechanism, a quotagranted by an OCS is distributed to different user planes for usage, butservice quota usage on the different user planes greatly differs (forexample, in a speed). This seriously affects quota managementefficiency, costs, and accuracy.

SUMMARY

Embodiments of this application provide a charging method, to resolve aproblem of online charging in a network architecture having a pluralityof user planes.

According to a first aspect, a charging method is provided, including:determining, by a session management function (SMF), a data flow routedby each user plane function (UPF) and a charging key corresponding tothe data flow; for each UPF, sending, by the SMF to an online chargingsystem (OCS), a quota request for at least one charging key lackingavailable quota for the UPF, receiving, by the SMF, a quota granted bythe OCS to the at least one charging key for the UPF, and delivering, bythe SMF, the granted quota to the UPF; receiving, by the SMF, quotausage information that corresponds to at least one quota and that isreported by at least one UPF; and sending, by the SMF to the OCS, acharging reporting message generated based on the quota usageinformation corresponding to the at least one quota.

Different UPFs are distinguished to grant and manage quotascorresponding to charging keys, to improve accuracy of creditauthorization control and network efficiency, and resolve a problem ofonline charging in a network architecture having a plurality of userplanes.

With reference to the first aspect, in a first possible implementationof the first aspect, each quota request includes an identifier of acorresponding UPF and a corresponding charging key, the SMF adds eachquota request to a same quota request message sent to the OCS, and thequota request message carries a quota request of the at least one UPF.

With reference to the first aspect or the first possible implementationof the first aspect, in a second possible implementation, the SMF sendsthe quota request message to the OCS for each UPF, each quota requestmessage includes a charging identifier of a corresponding UPF andincludes a quota request of at least one charging key for thecorresponding UPF, and each quota request includes a correspondingcharging key.

The foregoing two different quota requesting manners may be selectedaccording to actual requirements, so that the solution is implementedmore flexibly.

With reference to any one of the first aspect or the first and thesecond possible implementations of the first aspect, in a third possibleimplementation, the SMF receives a quota response message, and the quotaresponse message includes the quota granted to the at least one chargingkey on each UPF, and an identifier of the UPF corresponding to thequota.

With reference to any one of the first aspect or the first to the thirdpossible implementations of the first aspect, in a fourth possibleimplementation, the SMF separately receives quota response messagescorresponding to different UPFs, and the quota response message includesa charging identifier of a corresponding UPF and a quota granted to atleast one charging key for the corresponding UPF.

For the two different quota requesting manners, this embodiment of thisapplication also provides two granted quota returning manners.

With reference to any one of the first aspect or the first to the fourthpossible implementations of the first aspect, in a fifth possibleimplementation, the charging reporting message includes the quota usageinformation corresponding to the at least one quota, and furtherincludes an identifier of a UPF corresponding to the quota and acorresponding charging key, and the charging reporting message carriesquota usage information of the at least one UPF.

With reference to any one of the first aspect or the first to the fifthpossible implementations of the first aspect, in a sixth possibleimplementation, the SMF sends the charging reporting message to the OCSfor each UPF, and the charging reporting message includes a chargingidentifier of a corresponding UPF, and includes quota usage informationcorresponding to at least one quota of the corresponding UPF.

For the two different quota requesting and quota granting manners, thisembodiment of this application also provides two manners of reportingthe quota usage information.

With reference to any one of the first aspect or the first to the sixthpossible implementations of the first aspect, in a seventh possibleimplementation, the SMF determines, according to a policy delivered oractivated by a PCF, the charging key corresponding to the data flowrouted by each UPF.

With reference to any one of the first aspect or the first to theseventh possible implementations of the first aspect, in an eighthpossible implementation, before the SMF determines the data flow routedby each UPF and the charging key corresponding to the data flow, the SMFreceives a user session PDU session establishing request.

With reference to any one of the first aspect or the first to the eighthpossible implementations of the first aspect, in a ninth possibleimplementation, before the SMF receives the quota granted by the OCS,the SMF initiates, to the OCS, a request of establishing an onlinecharging session corresponding to a PDU session.

With reference to any one of the first aspect or the first to the ninthpossible implementations of the first aspect, in a tenth possibleimplementation, before the SMF determines the data flow routed by eachUPF and the charging key corresponding to the data flow, the SMFperforms UPF selection or UPF reselection.

With reference to any one of the first aspect or the first to the tenthpossible implementations of the first aspect, in an eleventh possibleimplementation, the SMF performs UPF selection when establishing the PDUsession, and the SMF performs UPF reselection when adding or deleting aUPF anchor for the PDU session, or adjusting an inter-UPF service dataflow.

With reference to any one of the first aspect or the first to theeleventh possible implementations of the first aspect, in a twelfthpossible implementation, the UPF is a UPF that performs a control policydelivered by the policy control function PCF, or the UPF is a classifierclassifier or a branching point branching point.

With reference to any one of the first aspect or the first to thetwelfth possible implementations of the first aspect, in a thirteenthpossible implementation, when the UPF is a classifier or a branchingpoint, the SMF receives quota usage information reported by theclassifier or the branching point, and UPF anchors are distinguishedfrom each other for the quota usage information.

With reference to any one of the first aspect or the first to thethirteenth possible implementations of the first aspect, in a fourteenthpossible implementation, the SMF determines, based on at least one of aservice type, UPF load, and a control policy configured on the SMF orreceived from the PCF, the data flow routed by each UPF.

According to a second aspect, a charging method is provided, including:receiving, by an online charging system OCS from a session managementfunction SMF, a quota request, of each user plane function UPF, for atleast one charging key without available quota; sending, by the OCS tothe SMF, a quota granted to the at least one charging key withoutavailable quota; and receiving, by the OCS, a charging reporting messagefrom the SMF, where the charging reporting message includes quota usageinformation corresponding to at least one quota.

Different UPFs are distinguished to grant and manage quotascorresponding to charging keys, to improve accuracy of creditauthorization control and network efficiency, and resolve a problem ofonline charging in a network architecture having a plurality of userplanes.

With reference to the second aspect, in a first possible implementationof the second aspect, each quota request includes an identifier of a UPFrequesting a quota and a corresponding charging key, the quota requestis carried in a quota request message, and the quota request messagecarries a quota request of at least one UPF.

With reference to the second aspect or the first possible implementationof the second aspect, in a second possible implementation, a quotarequest of each UPF is carried in a same quota request message, quotarequests of different UPFs are carried in different quota requestmessages, and each quota request message includes a charging identifierof a corresponding UPF and includes a quota request of at least onecharging key for the corresponding UPF.

With reference to any one of the second aspect or the first and thesecond possible implementations of the second aspect, in a thirdpossible implementation, the OCS returns a quota response message to theSMF, and the quota response message includes the quota granted to the atleast one charging key on each UPF, and an identifier of the UPFcorresponding to the quota.

With reference to any one of the second aspect or the first to the thirdpossible implementations of the second aspect, in a fourth possibleimplementation, the OCS separately sends quota response messagescorresponding to different UPFs to the SMF, and the quota responsemessage includes a charging identifier of a corresponding UPF and aquota granted to at least one charging key for the corresponding UPF.

With reference to any one of the second aspect or the first to thefourth possible implementations of the second aspect, in a fifthpossible implementation, the charging reporting message includes thequota usage information corresponding to the at least one quota, andfurther includes an identifier of a UPF corresponding to the quota and acorresponding charging key, and the charging reporting message carriesquota usage information of the at least one UPF.

With reference to any one of the second aspect or the first to the fifthpossible implementations of the second aspect, in a sixth possibleimplementation, quota usage information of each UPF is carried in a samecharging reporting message, quota usage information of different UPFs iscarried in different charging reporting messages, and each chargingreporting message includes a charging identifier of a corresponding UPFand includes quota usage information corresponding to at least one quotaof the corresponding UPF.

With reference to any one of the second aspect or the first to the sixthpossible implementations of the second aspect, in a seventh possibleimplementation, before the OCS grants the quota to the SMF, the OCSreceives, from the SMF, a request of establishing an online chargingsession corresponding to a PDU session.

According to a third aspect, a charging method is provided, including:receiving, by a user plane function (UPF), a granted quota from asession management function (SMF); receiving, by the UPF, a plurality ofdata flows, where the quota is used for the plurality of data flows, andcollecting, in a distinguished manner based on UPF anchors correspondingto the plurality of data flows, statistics on quota usage informationcorresponding to the quota; and sending, by the UPF, the quota usageinformation corresponding to the quota to the SMF, where the quota usageinformation includes quota usage values for which UPF anchors aredistinguished and an identifier of a corresponding UPF anchor.

With reference to the third aspect, in a first possible implementationof the third aspect, the UPF is a classifier classifier or a branchingpoint branching point.

According to a fourth aspect, a computing device is provided, includinga processor, a memory, a bus, and a communications interface, where thememory is configured to store a computing-device executable instruction,the processor is connected to the memory by using the bus, and when thecomputing device operates, the processor executes the computerexecutable instruction stored in the memory, so that the computingdevice performs the method according to any one of the first aspect orthe possible implementations of the first aspect.

According to a fifth aspect, a computing device is provided, including aprocessor, a memory, a bus, and a communications interface, where thememory is configured to store a computing-device executable instruction,the processor is connected to the memory by using the bus, and when thecomputing device operates, the processor executes the computerexecutable instruction stored in the memory, so that the computingdevice performs the method according to any one of the second aspect orthe possible implementations of the second aspect.

According to a sixth aspect, a computing device is provided, including aprocessor, a memory, a bus, and a communications interface, where thememory is configured to store a computing-device executable instruction,the processor is connected to the memory by using the bus, and when thecomputing device operates, the processor executes the computerexecutable instruction stored in the memory, so that the computingdevice performs the method according to any one of the third aspect orthe possible implementations of the third aspect.

According to a seventh aspect, a computer-readable storage medium isprovided, storing executable program code, where the program code isused to implement the method according to any one of the first aspect orthe possible implementations of the first aspect.

According to an eighth aspect, a computer-readable storage medium isprovided, storing executable program code, where the program code isused to implement the method according to any one of the second aspector the possible implementations of the second aspect.

According to a ninth aspect, a computer readable storage medium isprovided, storing executable program code, where the program code isused to implement the method according to any one of the third aspect orthe possible implementations of the third aspect.

According to a tenth aspect, a charging apparatus is provided, includingmodules configured to perform the method according to any one of thefirst aspect or the possible implementations of the first aspect.

According to an eleventh aspect, a charging apparatus is provided,including modules configured to perform the method according to any oneof the second aspect or the possible implementations of the secondaspect.

According to a twelfth aspect, a charging apparatus is provided,including modules configured to perform the method according to any oneof the third aspect or the possible implementations of the third aspect.

According to the technical solutions provided in the embodiments of thisapplication, different UPFs are distinguished to grant and manage quotascorresponding to charging keys, to improve accuracy of creditauthorization control and network efficiency, and resolve a problem ofonline charging in a network architecture having a plurality of userplanes.

BRIEF DESCRIPTION OF THE DRAWINGS

To describe the technical solutions in the embodiments of thisapplication or in the prior art more clearly, the following brieflydescribes the accompanying drawings required for describing theembodiments or the prior art.

FIG. 1 is a schematic diagram of a network architecture in which acontrol plane and a user plane are separated in the prior art;

FIG. 2 is a schematic diagram of a network architecture according to anembodiment of this application;

FIG. 3 is a schematic diagram of a hardware structure of a computerdevice 300 according to an embodiment of this application;

FIG. 4 is an illustrative flowchart of a charging method 400 accordingto an embodiment of this application;

FIG. 5 is an illustrative flowchart of a charging method 500 accordingto an embodiment of this application;

FIG. 6 is an illustrative flowchart of a charging method 600 accordingto an embodiment of this application;

FIG. 7 is an illustrative flowchart of a charging method 700 accordingto an embodiment of this application;

FIG. 8 is an illustrative flowchart of a charging method 800 accordingto an embodiment of this application;

FIG. 9 is a schematic structural diagram of a charging device 900according to an embodiment of this application; and

FIG. 10 is a schematic structural diagram of a charging system 1000according to an embodiment of this application.

DETAILED DESCRIPTION OF ILLUSTRATIVE EMBODIMENTS

Network element names described in the embodiments of this applicationconstitute no limitation on devices. Specifically, a name of a sessionmanagement function constitutes no limitation on a device, and may beanother name in practice, for example, a session manager. A name of apolicy control function constitutes no limitation on a device, and maybe another name in practice, for example, a policy controller. A name ofa user plane function constitutes no limitation on a device, and may beanother name in practice, for example, a user plane function entity. Aname of an online charging system constitutes no limitation on a device,and may be another name in practice, for example, a charging system oranother name. This is collectively described herein, and is no longerdescribed below in detail.

Solutions in the embodiments of this application may be applied to 5Gand other future systems.

FIG. 2 is a schematic diagram of a network architecture according to anembodiment of this application. An SMF is a session management function,a PCF is a policy control function, a UPF is a user plane function, anOCS is an online charging system, and UE is user equipment. The SMFcommunicates with the PCF through an N7 interface, the SMF communicateswith the UPF through an N4 interface, and different UPFs communicatewith each other through an N9 interface.

Functions of the SMF include: management, such as establishment,modification, and release, of a protocol data unit (PDU) session,internet protocol (IP) address assignment of the UE, UPF selection, UPFrouting policy configuration, obtaining of a control policy of the PCFand execution of a control plane part of the control policy, anddetermining of a service and session continuity (SSC) mode (referred toas an SSC mode) of the PDU session under an IP type.

Functions of the UPF include: completion of an anchor function ofinteraction with an external data network (a UPF having an anchorfunction is referred to as a UPF anchor), data packet routing andforwarding, data packet detection, and execution of a user plane part ofa control policy activated by the PCF.

Functions of the PCF include generation and delivery of a policy, oractivation of a policy statically configured on the SMF, and control, byusing a policy, of QoS, gating, charging, and the like of a service dataflow routed by a UPF. The SMF may determine, according to the policydelivered by the PCF, whether to establish an online charging sessionwith the OCS and determine a charging key corresponding to the servicedata flow.

Functions of the OCS include performing quota granting according to arequest of the SMF and performing balance deduction or returning basedon quota usage information reported by the SMF.

The UE is a device having a subscriber permanent identity (SUPI) or aninternational mobile subscriber identity (IMSI), or may be a mobilephone having a SIM/eSIM, a tablet computer, a computer, an IoT device,or another device that may be connected to a 5G network.

The SMF, the OCS, and the UPF may be implemented in a form of a computerdevice. FIG. 3 is a schematic diagram of a hardware structure of acomputer device 300 according to an embodiment of this application. Asshown in FIG. 3, the computer device 300 includes a processor 302, amemory 304, a communications interface 306, and a bus 308. The processor302, the memory 304, and the communications interface 306 are in acommunication connection to each other by using the bus 308.

The processor 302 may be a general-purpose central processing unit(CPU), a microprocessor, an application-specific integrated circuit(ASIC), or one or more integrated circuits, to execute a related programto implement the technical solutions provided in the embodiments of thisapplication.

The memory 304 may be a read-only memory (ROM), a static storage device,a dynamic storage device, or a random access memory (RAM). The memory304 may store an operating system 3041 and another application program3042. When the technical solutions provided in the embodiments of thisapplication are implemented by using software or firmware, program codeused to implement the technical solutions provided in the embodiments ofthis application is stored in the memory 304, and is executed by theprocessor 302.

The communications interface 306 uses a transceiver apparatus, forexample, but not limited to a transceiver, to implement communicationwith another device or a communications network.

The bus 308 may include a channel for transferring information betweencomponents (for example, the processor 302, the memory 304, and thecommunications interface 306).

When the computer device 300 is an SMF, the processor 302 executesprogram code stored in the memory 304 to implement the technicalsolutions provided in the embodiments of this application, to implementthe methods provided in the embodiments shown in FIG. 4 to FIG. 8.

When the computer device 300 is an OCS, the processor 302 executesprogram code stored in the memory 304 to implement the technicalsolutions provided in the embodiments of this application, to implementthe methods provided in the embodiments shown in FIG. 4 to FIG. 8.

When the computer device 300 is a UPF, the processor 302 may furtherexecute program code stored in the memory 304 to implement the technicalsolutions provided in the embodiments of this application, to implementthe methods provided in the embodiments shown in FIG. 4 to FIG. 8.

In this embodiment of this application, different UPFs are distinguishedto apply for and grant a quota, so that when different UPFs have a samecharging key, quota management efficiency and accuracy are not reducedbecause of a quota usage difference on the different UPFs, and accuracyof credit authorization control and network efficiency can be improved.

The following describes a process of distinguishing between differentUPFs to perform quota management with reference to specificimplementations.

FIG. 4 is an illustrative flowchart of a charging method 400 accordingto an embodiment of this application. The following describes how toidentity different UPFs to perform quota management with reference tospecific steps. The charging method 400 may be performed by the SMF, theOCS, and the UPF shown in FIG. 2.

S401: An SMF receives a PDU session establishing request from UE, andinitiates, to an OCS, to establish an online charging sessioncorresponding to the PDU session.

The PDU session is established between the UE and a data network (DN)that provides a PDU connection service. A UPF is connected to the DN.Therefore, in other words, the PDU session is established between the UEand the UPF. Because establishing the PDU session is controlled by theSMF, the UE sends the PDU session establishing request to the SMF, andthe SMF selects a UPF establishing a connection to the UE.

The online charging session is established between the SMF and the OCS.To charge a used service online, the OCS establishes a correspondingonline charging session for each PDU session. Quota requesting andgranting, and reporting of charging information including quota usageare all performed by using the online charging session established forthe PDU session.

After receiving the PDU session establishing request, the SMF requests acontrol policy from a PCF. The control policy includes information suchas a charging key, quality of service (QoS) control, gating control, andapplication detection. The SMF determines, according to the controlpolicy, the online charging session that needs to be established for thePDU session. The control policy may be delivered by the PCF to the SMF,or may be preconfigured on the SMF and activated by delivering aninstruction by the PCF to the SMF.

A request message that is sent by the SMF to the OCS to establish theonline charging session carries an identifier of a user. Because the UEhas a plurality of IP addresses, to avoid management disorder on theOCS, the user is identified by using an SUPI or an IMSI.

The following uses a diameter protocol as an example to present therequest message for establishing the online charging session. It shouldbe noted that the diameter protocol is merely used as an example herein,a message format is not limited in this application, and another messageformat such as REST API may be alternatively used.

<CCR> Session-Id // Session identifier Origin-Host // Origin hostOrigin-Realm // Origin realm Destination-Realm // Destination realmAuth-Application-Id // Application identifier Service-Context-Id //Service context identifier CC-Request-Type // Request typeCC-Request-Number // Message sequence number Destination-Host //Destination host Subscription-Id // User identifier

S402: The SMF selects a UPF.

The SMF may select a UPF based on at least one of the followinginformation: a control policy, dynamic UPF load, a relative static UPFdirect capacitance that supports a same data network name (DNN), anavailable UPF location in the SMF, UPF location information, a UPFcapability and a function required by a special UE session, a datanetwork name, a PDU session type, an SSC mode selected for a PDUsession, a user subscription profile in user data management (UDM), atraffic routing destination, and network slice-related information.

In addition to UPF selection, the SMF further determines a UPF thatneeds to perform a charging statistics collection function. In actualapplication, UPFs selected by the SMF may include a UPF performing acontrol policy and a UPF not performing a control policy. The SMFdetermines the UPF performing a control policy as a charging collectionpoint to perform a charging statistics collection function. In thisembodiment, the UPFs selected by the SMF are UPFs performing a controlpolicy. Therefore, the UPFs selected by the SMF perform a chargingstatistics collection function.

When the SMF selects only one UPF, the UPF performs the control policyand the charging statistics collection function.

S403: The SMF determines a data flow routed by each UPF and a chargingkey corresponding to the data flow.

The SMF may determine, according to a control policy, a service type,UPF load, and the like, the data flow routed by each UPF.

For example, a data flow of a service (for example, a video service) maybe assigned to a UPF near the UE, a data flow of a service having a highQoS bandwidth requirement may be assigned to a UPF having higherbandwidth, and if a UPF has excessive load, a data flow is assigned to aUPF having lower load.

The SMF may determine, according to the control policy delivered oractivated by the PCF, the charging key corresponding to the data flow.The control policy delivered or activated by the PCF includes a flowtemplate and a corresponding charging key. The SMF determines thecorresponding charging key based on the determined UPF and a data flowdistribution status of the UPF and based on a correspondence between adata flow and a charging key in the control policy.

S404: For each UPF, the SMF sends, to the OCS, a quota request of atleast one charging key without available quota for the UPF, receives aquota granted by the OCS to the at least one charging key for the UPF,and delivers the granted quota to the UPF.

An operation of each UPF is specifically described by using thefollowing S4041, S4042, and S4043.

S4041: The SMF sends, to the OCS, the quota request of the at least onecharging key without available quota for the UPF.

Not all charging keys need to use a quota, and the SMF requests a quotaonly for a charging key that needs to use a quota.

The charging key without available quota herein includes two cases.First, before an initial quota of the charging key is applied for, thecharging key has no available quota; and second, for the charging key, aquota is previously applied for, but no quota corresponding to thecharging key is available on the SMF because the quota is used up,expires, or the like.

Because data flows routed by different UPFs may use a same charging key,to avoid that quota usage of the same charging key of the different UPFsinterferes with each other during quota management, the SMF separatelyrequests a quota from the OCS for the same charging key of the differentUPFs.

Similarly, data flows routed by a same UPF may use different chargingkeys, and the SMF requests separate quotas from the OCS for thedifferent charging keys of the same UPF.

The SMF may request a quota from the OCS in the following two methods.

Method 1: The SMF adds an identifier of a corresponding UPF and acorresponding charging key to the quota request, where identifiers ofdifferent UPFs are used to identity quota requests from different UPFs.The SMF sends a quota request message to the OCS by using the onlinecharging session established for the PDU session in S401.

Specifically, quota requests of a plurality of charging keys on a sameUPF and quota requests of charging keys on different UPFs of the PDUsession may be carried in a same quota request message sent to the OCS.That is, one quota request message may carry quota requests of one ormore UPFs, and quota requests of different UPFs may have a same chargingkey or different charging keys.

The following uses a diameter protocol as an example to present thequota request message in the method 1. It should be noted that thediameter protocol is merely used as an example herein, a message formatis not limited in this application, and another message format such asREST API may be alternatively used.

<CCR> Session-Id // Session identifier Subscription-Id // Useridentifier Multiple-Services-Credit-Control // Quota request of acharging key 1 for a UPF1  Requested-Service-Unit // Requested quota Service-Identifier1 // Service identifier  Charging Key 1 // Ratinggroup  UPF1 // Identifier of the UPF1Multiple-Services-Credit-Control // Quota request of a charging key 2for the UPF1  Requested-Service-Unit // Requested quota  Charging Key2 // Rating group  UPF1 // Identifier of the UPF1Multiple-Services-Credit-Control // Quota request of the charging key 2for a UPF2  Requested-Service-Unit // Requested quota  Charging Key 2 //Rating group  UPF2 // Identifier of the UPF2

In this example, the quota request message includes three quotarequests: a quota request of the charging key 1 for the UPF1, a quotarequest of the charging key 2 for the UPF1, and a quota request of thecharging key 2 for the UPF2. Each quota request includes a correspondingcharging key, a quota requested for the corresponding charging key, andan identifier of a corresponding UPF. The quota request of the chargingkey 1 for the UPF1 further includes a service identifierService-Identifiers, indicating that a service whose service identifieris Service-Identifier) exclusively uses the charging key 1 and anotherservice cannot use the charging key 1.

Method 2: The SMF sends a quota request message to the OCS for each UPF,where each quota request message includes a charging identifier of acorresponding UPF and includes a quota request for at least one chargingkey for the corresponding UPF, and each quota request includes acorresponding charging key.

The charging identifier of the UPF herein is used to indicate that thequota request message is used for charging of a particular UPF. Thecharging identifier of the UPF may be an identifier of a chargingsub-session in a charging session of a PDU session corresponding to aparticular UPF, or another identifier. The SMF stores a correspondencebetween the charging identifier of the UPF and the UPF.

The SMF divides the online charging session established for the PDUsession in S401 into a plurality of charging sub-sessions, and allocatesa charging sub-session to each UPF. Specifically, the SMF may allocate acharging sub-session identifier to each UPF. Each charging sub-sessionis used by only one UPF. A quantity of charging sub-sessions is the sameas that of UPFs, and each charging sub-session and a UPF are in aone-to-one correspondence. Each charging sub-session has a uniquesession identifier, and the SMF stores a correspondence between a UPFand a charging sub-session. The OCS manages a quota in a distinguishedmanner based on different charging sub-sessions. Quota requests of aplurality of charging keys on a same UPF are carried in a same quotarequest message sent to the OCS, and quota requests of different UPFscannot be carried in a same quota request message. The quota requestmessage of each UPF is transmitted to the OCS by using the chargingsub-session corresponding to the UPF.

The following uses a diameter protocol as an example to present thequota request message in the method 2. It should be noted that thediameter protocol is merely used as an example herein, a message formatis not limited in this application, and another message format such asREST API may be alternatively used.

<CCR> //CCR message corresponding to a UPF1, where the CCR message cancarry a quota request of one or more charging keys only for the UPF1Session-Id CC-Sub-Session-Id 1 // Charging identifier of the UPF1Subscription-Id Multiple-Services-Credit-Control // Quota request of acharging key 1 for the UPF1  Requested-Service-Unit  Service-Identifier1 Charging Key 1 Multiple-Services-Credit-Control // Quota request of acharging key 2 for the UPF1  Requested-Service-Unit  Charging Key 2<CCR> //CCR message corresponding to a UPF2, where the message can carrya quota request of one or more charging keys only for the UPF2Session-Id CC-Sub-Session-Id 2 // Charging identifier of the UPF2Subscription-Id Multiple-Services-Credit-Control // Quota request for acharging key 2 for the UPF2 Requested-Service-Unit  Charging Key 2

In this example, the quota request message corresponding to the UPF1includes two quota requests: the quota request for the charging key 1and the quota request for the charging key 2. The quota request messagecorresponding to the UPF2 includes one quota request: the quota requestfor the charging key 2. The quota request message corresponding to theUPF1 includes the charging identifier CC-Sub-Session-Id 1 of the UPF1,and the quota request message corresponding to the UPF2 includes thecharging identifier CC-Sub-Session-Id 2 of the UPF2. Each quota requestincludes a charging key and a quota requested for the correspondingcharging key.

It should be noted that in this embodiment of this application, thequota request message is a message, such as a diameter CCR, sent by theSMF to the OCS to request a quota. The quota request is requestinformation for a charging key. The request information may bemultiple-services-credit-control. The quota request is carried in thequota request message.

A quota for a charging key may be requested in two manners. In onemanner, a requested quota is sent to the OCS. In the other manner, onlya request carrying no specific quota is sent to the OCS, and the OCSdetermines a granted quota.

S4042: The SMF receives the quota granted by the OCS to the at least onecharging key for the UPF.

The at least one charging key for the UPF in this step corresponds tothe at least one charging key without available quota for the UPF instep S4041.

For the two methods for requesting the quota from the OCS in S4041, theOCS also returns the granted quota to the SMF in two methods.

For the method 1 in S4041, the OCS returns the granted quota to the SMFin the following method.

The OCS adds a granted quota of at least one charging key on a same UPF,and granted quotas of charging keys on different UPFs of the PDU sessionto a same quota response message returned to the SMF. The OCS identifiesthe granted quotas of different UPFs by using identifiers of the UPFs,and adds, to the quota response message, the UPF identifiersrespectively corresponding to the granted quotas. The OCS sends thequota response message to the SMF by using the online charging sessionestablished for the PDU session in S401.

The following uses a diameter protocol as an example to present thequota response message corresponding to the method 1. It should be notedthat the diameter protocol is merely used as an example herein, amessage format is not limited in this application, and another messageformat such as REST API may be alternatively used.

<CCA> Session-Id Multiple-Services-Credit-Control  Granted-Service-Unit// Granted quota 1  Service-Identifier1  Charging Key 1  UPF1 //Identifier of the UPF1 Multiple-Services-Credit-Control Granted-Service-Unit // Granted quota 2  Charging Key 2  UPF1 //Identifier of the UPF1 Multiple-Services-Credit-Control Granted-Service-Unit // Granted quota 3  Charging Key 2  UPF2 //Identifier of the UPF2

For the method 2 in S4041, the OCS returns the granted quota to the SMFin the following method.

The OCS returns the quota response message for each UPF. Each quotaresponse message includes a charging identifier of a corresponding UPFand a quota granted to at least one charging key for the correspondingUPF. The OCS adds, to a same quota response message, quotas granted to aplurality of charging keys on a same UPF, and adds, to different quotaresponse messages, quotas granted to different UPFs. The quota responsemessage returned for each UPF is transmitted to the SMF by using acharging sub-session corresponding to the UPF.

The following uses a diameter protocol as an example to present thequota response message in the method 2. It should be noted that thediameter protocol is merely used as an example herein, a message formatis not limited in this application, and another message format such asREST API may be alternatively used.

<CCA> // CCA message corresponding to the UPF1, where the message cancarry only a quota granted to one or more charging keys on the UPF1Session-Id CC-Sub-Session-Id 1 // Charging identifier of the UPF1Multiple-Services-Credit-Control  Granted-Service-Unit // Granted quota1  Service-Identifier1  charging key 1 // Rating group 1 of the UPF1Multiple-Services-Credit-Control  Granted-Service-Unit // Granted quota2  charging key 2 // Rating group 2 of the UPF1 <CCA> // CCA messagecorresponding to the UPF2, where the message can carry only a quotagranted to one or more charging keys on the UPF2 Session-IdCC-Sub-Session-Id 2 // Charging identifier of the UPF2Multiple-Services-Credit-Control  Granted-Service-Unit // Granted quota3  charging key 2 // Rating group 2 of the UPF2

S4043: The SMF delivers the granted quota to the UPF.

The SMF delivers the granted quota to the corresponding UPF based on acorrespondence between the quota and the UPF. In the method 1, the SMFdelivers the granted quota to the corresponding UPF based on thecorrespondence between the granted quota and the identifier of the UPF.In the method 2, the SMF delivers the granted quota to the correspondingUPF based on the correspondence between the charging identifier of theUPF and the UPF.

According to the example in S4042, the SMF delivers, to the UPF1, thequotas 1 and 2 granted by the OCS, and delivers the granted quota 3 tothe UPF2.

S405: The SMF receives quota usage information that corresponds to theat least one quota and that is reported by the at least one UPF.

Quota usage of different charging keys on a same UPF is independent fromeach other. Quota usage of different UPFs is also independent from eachother regardless of whether charging keys are the same.

The quota usage information is reported when a trigger condition issatisfied. Different charging keys on a same UPF may have a same triggercondition, or may have different trigger conditions. Same charging keyon different UPFs may have a same trigger condition, or may havedifferent trigger conditions. Reporting of quota usage of differentcharging keys on a same UPF is independent from each other. Reporting ofquota usage of different UPFs is also independent from each otherregardless of whether charging keys are the same. The trigger conditionincludes that a quota is used up, a quota expires, a reporting conditionspecified by the OCS is satisfied (for example, a QoS change, a locationchange, or an access type change), and a PDU session is released.

It is assumed that the quota 1 of the charging key 1 on the UPF1 is usedup, and the quota 3 of the charging key 2 on the UPF2 is used up. Inthis case, the trigger condition is satisfied, the UPF1 reports quotausage information of the charging key 1 to the SMF, and the UPF2 reportsquota usage information of the charging key 2 to the SMF.

S406: The SMF sends, to the OCS, a charging reporting message generatedbased on the quota usage information corresponding to the at least onequota.

The SMF determines, based on quota usage information of each quota, acorresponding UPF of the quota and a corresponding charging key, andsends the quota usage information of the quota, the corresponding UPF,and the corresponding charging key to the OCS by using the chargingreporting message.

For the method 1 in S4041, the SMF sends the quota usage information tothe OCS by using the following method.

The SMF adds quota usage information of a plurality of quotas of a sameUPF, and quota usage information of quotas of different UPFs in the PDUsession to the same charging reporting message sent to the OCS. The SMFdistinguishes quota usage information of different UPFs by using UPFidentifiers. The SMF sends the charging reporting message to the OCS byusing the online charging session established for the PDU session inS401.

The following uses a diameter protocol as an example to present thecharging reporting message in the method 1. It should be noted that thediameter protocol is merely used as an example herein, a message formatis not limited in this application, and another message format such asREST API may be alternatively used.

In this example, assuming that the quota 1 of the charging key 1 on theUPF1 and the quota 3 of the charging key 2 on the UPF2 satisfy thetrigger condition, the reported charging message is as follows:

<CCR> Session-Id Multiple-Services-Credit-Control  Used-Service-Unit //Quota usage information of the quota 1  Requested-Service-Unit // Newlyrequested quota of the charging key 1 on the UPF1  Charging Key 1 UPF1 // Identifier of the UPF1 Multiple-Services-Credit-Control // Used-Service-Unit // Quota usage information of the quota 3 Requested-Service-Unit // Newly requested quota of the charging key 2on the UPF2  Charging Key 2  UPF2 // Identifier of the UPF2

In this example, the charging reporting message includes two pieces ofquota usage information: the quota usage information of the quota 1 onthe UPF1 and the quota usage information of the quota 3 on the UPF2. Thecharging reporting message includes a charging key corresponding to thequota 1 and a UPF identifier corresponding to the quota 1, that is, thecharging key 1 and the UPF1; includes a charging key corresponding tothe quota 3 and a UPF identifier corresponding to the quota 3, that is,the charging key 2 and the UPF2; and further includes a newly requestedquota of a corresponding charging key. When a service is not ended, anew quota is applied while the quota usage information is reported.

For the method 2 in S4041, the SMF sends the quota usage information tothe OCS by using the following method.

The SMF sends the charging reporting message to the OCS for each UPF,where each charging reporting message includes a charging identifier ofa corresponding UPF and includes quota usage information correspondingto at least one quota of the UPF. The SMF adds quota usage informationof a plurality of quotas of a same UPF to a same charging message sentto the OCS, and adds quota usage information of quotas of different UPFsto different charging reporting messages. The charging reporting messagefor each UPF is transmitted to the OCS by using a charging sub-sessioncorresponding to the UPF.

The following uses a diameter protocol as an example to present thecharging reporting message in the method 2. It should be noted that thediameter protocol is merely used as an example herein, a message formatis not limited in this application, and another message format such asREST API may be alternatively used.

<CCR> Session-Id CC-Sub-Session-Id 1 // Charging identifier of the UPF1Multiple-Services-Credit-Control  Used-Service-Unit // Quota usageinformation of the quota 1  Requested-Service-Unit // Newly requestedquota of the charging key 1 on the UPF1  Charging Key 1 <CCR> Session-IdCC-Sub-Session-Id 2 // Charging identifier of the UPF2Multiple-Services-Credit-Control  Used-Service-Unit // Quota usageinformation of the quota 3  Requested-Service-Unit // Newly requestedquota of the charging key 2 on the UPF2  Charging Key 2

The OCS charges based on the rating group and the quota usageinformation after receiving the charging reporting message.

When the PDU session needs to be released subsequently, if the userstops using the service, the SMF instructs all UPFs involved in the PDUsession to report the quota usage information, the SMF generates thecharging reporting message based on the quota usage information, sendsthe charging reporting message to the OCS, and releases the onlinecharging session established for the PDU session. For a manner ofsending the charging reporting message by the SMF to the OCS, refer tothe two manners in S406, and details are not described herein again.

A sequence of the three steps of S401, S402, and S403 may change.Establishment of the online charging session and requesting of the quotamay be combined in one message. For example, during establishing theonline charging session, the charging key corresponding to the data flowis already determined, and the quota request may be carried in therequest message for establishing the online charging session.

According to the technical solution provided in this embodiment of thisapplication, different UPFs are distinguished to grant and manage quotascorresponding to charging keys, to improve accuracy of creditauthorization control and network efficiency, and resolve a problem ofonline charging in a network architecture having a plurality of userplanes.

FIG. 5 is an illustrative flowchart of a charging method 500 accordingto an embodiment of this application. Different from the embodiment inFIG. 4, in the embodiment in FIG. 5, a UPF selected by an SMF includes aclassifier or a branching point. The SMF determines the classifier orthe branching point as a charging collection point to perform a chargingstatistics collection function. If the SMF determines a UPF performing acontrol policy as a charging collection point, to perform a chargingstatistics collection function, when the classifier or the branchingpoint performs the control policy, the method in the embodiment in FIG.5 is used; or when a UPF anchor performs the control policy, the methodin the embodiment in FIG. 4 is used. An uplink data flow from UE firstpasses through the classifier or the branching point, and the classifieror the branching point splits the data flow to different UPF anchors. Adownlink data flow first passes through different UPF anchors and thenpasses through the classifier or the branching point, and the classifieror the branching point combines downlink data flows and delivers acombined downlink data flow to the UE.

S501: An SMF receives a PDU session establishing request of UE, andinitiates, to an OCS, to establish an online charging sessioncorresponding to the PDU session.

For specific content, refer to S401 in the embodiment in FIG. 4, anddetails are not described herein again.

S502: The SMF determines a classifier as a UPF performing a chargingstatistics collection function.

The classifier or a branching point is used to split an uplink data flowon a user plane (split a data flow from the UE to different UPF anchors)and combine downlink data flows (combine data flows from different UPFanchors into one data flow and deliver a combined data flow to the UE).The classifier or the branching point is also a UPF that all data flowspass through. Therefore, the classifier or the branching point may beused as a charging collection point.

Because execution of a control policy affects charging accuracy, forexample, a gating control operation of the control policy may result ina packet loss, the classifier or the branching point may not actuallyperform the control policy. In this case, if charging is performed basedon all data packets passing through the classifier or the branchingpoint, deducted fees are greater than actual usage costs. Therefore, toensure charging accuracy, all control policies activated by a PCF areconfigured on the classifier or the branching point, and the classifieror the branching point collects charging information after simulatingexecution of a control policy, to ensure that collected charginginformation is consistent with charging information generated after theUPF performs the control policy.

For example, assuming there are a UPF1, a UPF2 and a classifier for aPDU session, the SMF determines the classifier as a UPF performing acharging statistics collection function. It is assumed that a controlpolicy performed by the UPF1 is as follows:

Policy Rule 1 { Flow 1: discard; } Policy Rule 2 { Flow 2+Flow 3:Charging Key 1, where a priority is 1; } Policy Rule 3 { Flow 3+Flow 4:Charging Key 2, where a priority is 2 }

The control policy is also delivered to the classifier. If theclassifier detects a data packet belonging to a flow 1, execution of thecontrol policy Policy Rule 1 is simulated. Because the policy rule 1indicates discarding the data packet, charging statistics collection isnot performed (in this case, the classifier does not actually discardthe data packet, and instead the UPF performing the policy rule 1performs a discarding operation). If the classifier detects a datapacket belonging to a flow 3, execution of the control policy issimulated. The flow 3 may be covered by both the charging key 1 and thecharging key 2. However, based on priorities of the two charging keys,the data flow of the flow 3 is matched with the charging key 1.Therefore, the classifier or the branching point collects statistics onthe data flow of the flow 3 by using the charging key 1.

S503: The SMF determines a data flow routed by the classifier and acharging key corresponding to the data flow.

In this embodiment, a plurality of UPFs are involved in the PDU session,and the plurality of UPFs includes a classifier or a branching point.Because all data flows pass through the classifier or the branchingpoint, the SMF determines a data flow routed by the classifier or thebranching point and a splitting rule. The splitting rule is determinedto determine a routing path of the data flow, to transmit the data flow.For example, the UPF1, the UPF2, and a UPF3 are involved in the PDUsession, where the UPF3 is a classifier that performs a chargingstatistics collection function and does not perform a control policy.The SMF determines a data flow routed by the UPF3, and determines,according to the splitting rule, data flows routed by the UPF1 and theUPF2.

S504: The SMF sends a quota request for a charging key without availablequota on the classifier to the OCS.

Because the classifier performs the charging statistics collectionfunction and has the control policy, the classifier stores charging keysrespectively corresponding to data flows.

For a specific process of requesting a quota, refer to S4041 in theembodiment in FIG. 4, and details are not described herein again.

S505: The SMF receives a quota granted by the OCS to the charging keywithout available quota on the classifier.

For a specific process of returning a granted quota by the OCS, refer toS4042 in the embodiment in FIG. 4, and details are not described hereinagain.

S506: The SMF delivers the granted quota to the classifier.

In this embodiment, the classifier performs the charging statisticscollection function, and the SMF delivers each granted quota to theclassifier. The classifier simulates execution of the control policy togenerate quota usage information.

S507: The SMF receives quota usage information that corresponds to atleast one quota and that is from the classifier.

The classifier identifies UPFs when reporting quotas of different UPFs.When the classifier sends quota usage information corresponding to aquota to the SMF, the quota usage information includes quota usage valuefor the identified UPF anchors and an identifier of a corresponding UPFanchor.

It is assumed that a quota 1 of the charging key 1 on the UPF1 is usedup, and a quota 3 of the charging key 2 on the UPF2 is used up. In thiscase, a trigger condition is satisfied, and the UPF3 reports quota usageinformation of the quota 1 on the UPF1 and quota usage information ofthe quota 3 on the UPF2 to the SMF.

For a specific process, refer to S407 in the embodiment in FIG. 4.

S508: The SMF sends, to the OCS, a charging reporting message generatedbased on the quota usage information.

For a specific process, refer to S406 in the embodiment in FIG. 4.

Different UPFs are grant and manage quotas corresponding to chargingkeys separately, to improve accuracy of credit authorization control andnetwork efficiency, and resolve a problem of online charging in anetwork architecture having a plurality of user planes.

In actual application, there may be the following three scenarios:

(1) A data flow of the UPF1 is migrated to the UPF2.

(2) A UPF is added to the PDU session.

(3) A UPF is deleted from the PDU session.

The following describes the first scenario with reference to FIG. 6.

The SMF establishes the online charging session for the PDU session, andrequest by using the online charging session, quotas for charging keysused by the data flow of the UPF1 and the UPF2. For a specific process,refer to S401 to S404 in the embodiment in FIG. 4.

S601: The SMF determines that at least one data flow of the UPF1 needsto be migrated to the UPF2.

Specifically, the SMF may perform determining based on the informationfor UPF selection in S402 in the embodiment in FIG. 4.

S602: The SMF or the UPF2 determines whether there is an available quotafor a charging key corresponding to the at least one data flow on thecurrent UPF2, where if there is an available quota, the at least onedata flow on the UPF2 uses the available quota for the charging key forthe UPF2, or if there is no available quota for the charging keycorresponding to some of the at least one data flow on the UPF2, the SMFsends a quota request to the OCS, to request a quota for the chargingkey corresponding to the some data flows of the UPF2.

Similarly, if there is no available quota for a charging key on the UPF,the SMF also requests a quota for the charging key without availablequota on the UPF1, and sends a quota request to the OCS.

For a specific manner of requesting a quota by the SMF, refer to S4041in the embodiment in FIG. 4.

For example, data flows routed by the UPF1 include a data flows, a dataflow 2, and a data flow 3, and corresponding charging keys are acharging key 1, a charging key 2, and a charging key3 respectively. Thedata flow 1 and the data flow 2 need to be migrated to the UPF2. If theSMF or the UPF1 determines that there is an available quota for thecharging key3 on the UPF, the SMF does not request a quota from the OCSfor the charging key3 on the UPF1. The SMF or the UPF2 determines thatthere is an available quota for the charging key 1 on the UPF2 and isnot an available quota for the charging key 2. In this case, the dataflow 1 uses the available quota for the charging key 1 on the UPF2, andthe SMF does not request a quota from the OCS for the charging key 1 onthe UPF2, and requests a quota for the charging key 2 on the UPF2 fromthe OCS.

S603: The OCS sends, to the SMF, a quota granted to a charging keycorresponding to the some data flows on the UPF2.

Similarly, the OCS also grants a quota for the charging key without anavailable quota on the UPF1.

For a specific process, refer to S4042 in the embodiment in FIG. 4.

S604: The SMF sends the granted quota to the UPF2.

Similarly, the SMF also sends the granted quota to the charging keywithout available quota on the UPF1.

S605: Migrate the at least one data flow to the UPF2.

S606: The UPF1 or the UPF2 reports quota usage information correspondingto at least one quota to the SMF.

For a specific process, refer to S405 in the embodiment in FIG. 4.

S607: The SMF sends, to the OCS, a charging reporting message generatedbased on the quota usage information.

For a specific process, refer to S406 in the embodiment in FIG. 4.

According to the technical solution provided in this embodiment of thisapplication, different UPFs are granted and managed a quotacorresponding to a charging key separately, thereby simplifying aprocessing process during data flow handover between different UPFs andimproving network efficiency.

The following describes the second scenario with reference to FIG. 7.

The SMF establishes the online charging session for the PDU session, andrequests, by using the online charging session, a quota for a chargingkey corresponding to a data flow of the UPF1. For a specific process,refer to S401 to S404 in the embodiment in FIG. 4.

S701: The SMF determines that the UPF2 needs to be added to route thedata flow.

Specifically, the SMF may perform determining based on the informationfor UPF selection in S402 in the embodiment in FIG. 4.

S702: The SMF determines a data flow of the UPF2 and a correspondingcharging key.

For a specific process, refer to S403 in the embodiment in FIG. 4.

S703: The SMF sends a quota request of each charging key for the UPF2 tothe OCS.

It should be noted that in this embodiment, before the UPF2 is added,the PDU session does not involve the UPF2. Therefore, there is no anavailable quota for the charging key corresponding to the data flow, ofthe PDU session, on the UPF2. Therefore, the SMF requests a quota foreach charging key for the UPF2.

For a specific process, refer to S4041 in the embodiment in FIG. 4.

S704: The OCS sends, to the SMF, a quota granted to each charging keyfor the UPF2.

For a specific process, refer to S4042 in the embodiment in FIG. 4.

S705: The SMF sends the granted quota to the UPF2.

S706: The UPF1 or the UPF2 reports quota usage information correspondingto at least one quota to the SMF.

For a specific process, refer to S405 in the embodiment in FIG. 4.

It is assumed that the UPF1 routes data flows of a data flow 1 and adata flow 2, where the data flow 1 uses the charging key 1 and the dataflow 2 uses the charging key 2. The UPF2 routes a data flow of a dataflow 3, where the data flow 3 uses the charging key 2. When a triggercondition corresponding to the charging key 1 on the UPF1 is satisfied,and a trigger condition corresponding to the charging key 2 on the UPF2is satisfied, the UPF1 reports quota usage information of the chargingkey 1 to the SMF, and the UPF2 reports quota usage information of thecharging key 2 to the SMF.

S707: The SMF sends, to the OCS, a charging reporting message generatedbased on the quota usage information.

For a specific process, refer to S406 in the embodiment in FIG. 4.

In S703 to S705, if the UPF1 has a charging key without available quota,the SMF also applies for a quota for the UPF1, and details are notdescribed herein again.

In this embodiment, the newly added UPF2 may be a classifier or abranching point. In this case, the classifier or the branching point isa charging collection point that performs a charging statisticscollection function. All data flows pass through the classifier or thebranching point, and the classifier or the branching point simulatesexecution of the control policy for each data flow. Therefore, in thiscase, in S706, the UPF2 (namely, the classifier or the branching point)sends the quota usage information to the SMF, and the UPF1 does not sendthe quota usage information to the SMF.

For example, it is assumed that the UPF1 routes data flows of a dataflow 1 and a data flow 2, where the data flow 1 uses the charging key 1and the data flow 2 uses the charging key 2. The newly added UPF2 is theclassifier, the UPF2 routes the data flow 1 and the data flow 2 andfurther routes a data flow 3, where the data flow 3 uses the chargingkey 2. When the trigger condition corresponding to the charging key 1 issatisfied, the classifier reports the quota usage information of thecharging key 1 to the SMF. When the trigger condition corresponding tothe charging key 2 is satisfied, the classifier reports the quota usageinformation of the charging key 2 to the SMF. The UPF1 does not send thequota usage information of the charging key 1 and the charging key 2 tothe SMF.

According to the technical solution provided in this embodiment of thisapplication, different UPFs are granted and managed a quotacorresponding to a charging key differently, thereby simplifyingprocessing of charging information when the UPF is newly added to thePDU session and improving network efficiency.

The following describes the third scenario with reference to FIG. 8.

The SMF establishes the online charging session for the PDU session, andrequests, by using the online charging session, quotas for charging keyscorresponding to data flows on the UPF1 and the UPF2. For a specificprocess, refer to S401 to S404 in the embodiment in FIG. 4.

S801: The SMF determines that the UPF2 needs to be deleted.

When determining that the UPF2 needs to be deleted, the SMF determinesthat the UPF2 no longer routes a data flow, and a charging keyoriginally corresponding to the data flow of the UPF2 no longer exists.

Specifically, the SMF determines, based on an SSC mode (for example, toswitch a UPF, a new UPF is first established, and an old UPF is deletedafter service data flows are all migrated to the new UPF), another SMFrule, or the like, that the UPF needs to be deleted.

The SMF determines the data flow and the charging key of the UPF1, forexample, determines whether to newly add a data flow, and determines acharging key of the newly added data flow. Subsequently, the SMF furtherrequests a quota for a charging key without available quota on the UPF1.For details, refer to S404 in the embodiment in FIG. 4, and details arenot described herein again.

S802: The SMF instructs the UPF2 to report quota usage information ofeach quota on the UPF2.

S803: The UPF2 reports the quota usage information of each quota on theUPF2 to the SMF.

It is assumed that data flows of the UPF2 are a data flow 1 and a dataflow 2, the data flow 1 corresponds to the charging key 1, and the dataflow 2 corresponds to the charging key 2. When receiving a notificationfrom the SMF for reporting each quota usage information, the UPF2reports the quota usage information of the charging key 1 and thecharging key 2 to the SMF.

S804: The SMF sends, to the OCS, a charging reporting message generatedbased on the quota usage information.

For a specific process, refer to S406 in the embodiment in FIG. 4.

After the SMF deletes the UPF2, quotas for each charging key for theUPF1 is not affected and can still be used.

In this embodiment, the deleted UPF2 may be a classifier or a branchingpoint. In this case, the classifier or the branching point reports thequota usage information of each quota to the SMF. Because the classifieror the branching point stores a charging key corresponding to each dataflow routed by each UPF, in this embodiment, the classifier or thebranching point reports quota usage information of a quota of eachcharging key for the UPF1 and the UPF2.

According to the technical solution provided in this embodiment of thisapplication, different UPFs are granted and managed a quotacorresponding to a charging key separately, thereby simplifyingprocessing of charging information when the UPF is deleted from the PDUsession and improving network efficiency.

It should be noted that determining a data flow routed by a UPF and acharging key corresponding to the data flow does not necessarily resultin a change of the data flow routed by the UPF and the charging keycorresponding to the data flow.

In this embodiment of this application, all UPFs perform the chargingstatistics collection function, and the charging statistics collectionfunction herein is an online charging statistics collection function.

FIG. 9 is a schematic structural diagram of a charging device 900according to an embodiment of this application. The charging device 900includes a processing module 902, a sending module 904, and a receivingmodule 906. The charging device 900 is the SMF in FIG. 2, the computerdevice in the embodiment in FIG. 3, and the SMF in the embodiment inFIG. 4 to FIG. 8. The processing module 902 may be configured to performS402 and S403 in the embodiment in FIG. 4, S502 and S503 in theembodiment in FIG. 5, S601 and S602 in the embodiment in FIG. 6, S701and S702 in the embodiment in FIG. 7, and S801 in the embodiment in FIG.8. The receiving module 906 may be configured to perform S401, S4042,and S405 in the embodiment in FIG. 4, S501, S505, and S507 in theembodiment in FIG. 5, S603 in the embodiment in FIG. 6, S704 and S706 inthe embodiment in FIG. 7, and S803 in the embodiment in FIG. 8. Thesending module 904 may be configured to perform S4041, S4043, and S406in the embodiment in FIG. 4, S504, S506, and S508 in the embodiment inFIG. 5, S602, S604, and S607 in the embodiment in FIG. 6, S703, S705,and S707 in the embodiment FIG. 7, and S802 and S804 in the embodimentin FIG. 8.

FIG. 10 is a schematic structural diagram of a charging system 1000according to an embodiment of this application. The charging system 1000includes a receiving module 1002 and a sending module 1004. The chargingsystem 1000 is the OCS in FIG. 2, the computer device in the embodimentin FIG. 3, and the OCS in the embodiment in FIG. 4 to FIG. 8. Thereceiving module 1002 may be configured to perform S4041 and S406 in theembodiment in FIG. 4, S504 and S508 in the embodiment in FIG. 5, S602and S607 in the embodiment in FIG. 6, S703 and S707 in the embodiment inFIG. 7, and S804 in the embodiment in FIG. 8. The sending module 1004may be configured to perform S4042 in the embodiment in FIG. 4, S505 inthe embodiment in FIG. 5, S603 in the embodiment in FIG. 6, and S704 inthe embodiment in FIG. 7.

The “module” in the embodiments of FIG. 9 and FIG. 10 may be anapplication-specific integrated circuit (ASIC), an electronic circuit, aprocessor for executing one or more software or firmware programs and amemory, an integrated logic circuit, or another component providing theforegoing functions. Optionally, the charging device and the chargingsystem are implemented in a form of a computer device. The receivingmodule and the sending module may be implemented by using a processor, amemory, and a communications interface of the computer device. Theprocessing module may be implemented by using the processor and thememory of the computer device.

It should be noted that although only the processor 302, the memory 304,the communications interface 306, and the bus 308 are shown in thecomputer device 300 in FIG. 3, in a specific implementation process, aperson skilled in the art should understand that the charging device andthe charging system further include other devices required forimplementing normal running. In addition, according to a specificrequirement, a person skilled in the art should understand that thecharging device and the charging system may further include a hardwaredevice for implementing another additional function. In addition, aperson skilled in the art should understand that the charging device andthe charging system may alternatively include only devices required forimplementing the embodiments of this application, and do not necessarilyinclude all devices shown in FIG. 3.

In addition, functional units in the embodiments of this application maybe integrated into one processing unit, or each of the units may existalone physically, or two or more units may be integrated into one unit.The integrated unit may be implemented in a form of hardware, or may beimplemented in a form of a software functional unit.

When the integrated unit is implemented in the form of a softwarefunctional unit and sold or used as an independent product, theintegrated unit may be stored in a computer-readable storage medium.Based on such an understanding, the technical solutions of thisapplication essentially, or the part contributing to the prior art, orall or some of the technical solutions may be implemented in a form of asoftware product. The computer software product is stored in a storagemedium and includes several instructions for instructing a computerdevice (which may be a personal computer, a server, a network device, orthe like) or a processor to perform all or some of the steps of themethods described in the embodiments of this application. The storagemedium includes any medium that can store program code, for example, aUSB flash drive, a removable hard disk, a read-only memory (ROM), arandom access memory (RAM), a magnetic disk, or a compact disc.

The foregoing descriptions are merely specific implementations of thisapplication, but are not intended to limit the protection scope of thisapplication. Any variation or replacement readily figured out by aperson skilled in the art within the technical scope disclosed in thisapplication shall fall within the protection scope of this application.Therefore, the protection scope of this application shall be subject tothe protection scope of the claims.

What is claimed is:
 1. A method comprising: determining, by a sessionmanagement function, a data flow associated with each of a plurality ofuser plane functions involved in a protocol data unit (PDU) session, anda charging key corresponding to the data flow in the PDU session; andsending, by the session management function to an online chargingsystem, a quota request for a first user plane function of the pluralityof user plane functions, the quota request requesting a first quota fora first charging key, with the first charging key corresponding to afirst data flow associated with the first user plane function of theplurality of user plane functions; receiving, by the session managementfunction, the first quota granted by the online charging system to thefirst charging key for the first user plane function; and delivering, bythe session management function, the granted first quota for the firstcharging key to the first user plane function.
 2. The method accordingto claim 1, wherein the quota request comprises an identifier of thefirst user plane function and the first charging key, and the quotarequest is carried in a quota request message.
 3. The method accordingto claim 1, wherein receiving the first quota comprises: receiving, bythe session management function, a quota response message, and the quotaresponse message comprises the first quota granted to the first chargingkey, and an identifier of the first user plane function corresponding tothe first quota.
 4. The method according to claim 1, further comprising:receiving, by the session management function, quota usage informationthat corresponds to at least one quota and that is reported by at leastone user plane function of the plurality of user plane functions; andsending, by the session management function to the online chargingsystem, a charging reporting message generated based on the quota usageinformation corresponding to the at least one quota.
 5. The methodaccording to claim 4, wherein the charging reporting message comprisesthe quota usage information corresponding to the first quota for thefirst charging key, and further comprises an identifier of the firstuser plane function corresponding to the first quota and the firstcharging key, and the charging reporting message carries quota usageinformation of the first user plane function.
 6. The method according toclaim 1, further comprising: determining, by the session managementfunction according to a policy delivered or activated by a policycontrol function, the charging key corresponding to the data flow. 7.The method according to claim 1, further comprising: before determiningthe data flow associated with each of the plurality of user planefunctions and the charging key corresponding to the data flow,performing, by the session management function, user plane functionselection or user plane function reselection.
 8. The method according toclaim 7, wherein the user plane function selection is performed whenestablishing the PDU session, and the user plane function reselection isperformed when adding or deleting a user plane function anchor for thePDU session, or adjusting a service data flow on a user plane function.9. A computing device, comprising a processor, a memory, a bus, and acommunications interface, wherein the memory is configured to store acomputing-device executable instruction, the processor is connected tothe memory using the bus, and when the computing device operates, theprocessor executes the computing-device executable instruction stored inthe memory, so that the computing device performs following steps:receiving, from a session management function, a quota request for afirst user plane function of a plurality of user plane functions thatinvolve in a protocol data unit (PDU) session, the quota requestrequesting grant of a first quota for a first charging key lacking anavailable quota, with the first charging key corresponding to a dataflow that is in the PDU session and that is associated with the firstuser plane function; and sending to the session management function, thefirst quota granted to the first charging key lacking the availablequota.
 10. The computing device according to claim 9, wherein the quotarequest comprises an identifier of the first user plane function and thefirst charging key, and the quota request is carried in a quota requestmessage.
 11. The computing device according to claim 9, wherein thecomputing device further performs: sending a quota response message tothe session management function, and the quota response messagecomprises the first quota granted to the first charging key and anidentifier of the first user plane function corresponding to the firstquota.
 12. The computing device according to claim 9, wherein thecomputing device further performs: receiving a charging reportingmessage from the session management function, wherein the chargingreporting message comprises quota usage information corresponding to thegranted first quota for the first charging key lacking the availablequota.
 13. The computing device according to claim 12, wherein thecharging reporting message comprises the quota usage informationcorresponding to a quota for a charging key from at least one user planefunction of the plurality of user plane functions, and an identifier ofthe at least one user plane function and the charging key correspondingto the quota.
 14. The computing device according to claim 12, whereinquota usage information of a same user plane function is carried in asame charging reporting message, and quota usage information ofdifferent user plane functions is carried in different chargingreporting messages, and wherein each of the different charging reportingmessages comprises a charging identifier of a corresponding user planefunction and quota usage information of the corresponding user planefunction.
 15. The computing device according to claim 12, wherein thecomputing device further performs: before sending the granted firstquota to the session management function, receiving, from the sessionmanagement function, a request for establishing an online chargingsession corresponding to the PDU session.
 16. A system comprising: aplurality of user plane functions, configured to involve in a protocoldata unit (PDU) session, and to transfer data flows in the PDU session;and a session management function, configured to determine a data flowassociated with each of the plurality of user plane functions involvedin the PDU session, and a charging key corresponding to the data flow inthe PDU session, to send, to an online charging system, a quota requestfor a first user plane function of the plurality of user planefunctions, the quota request requesting grant of a first quota for afirst charging key lacking an available quota, with the first chargingkey corresponding to a first data flow associated with the first userplane function of the plurality of user plane functions, and to receivethe first quota granted by the online charging system to the firstcharging key for the first user plane function.
 17. The system accordingto claim 16, wherein the session management function receives the firstquota granted by the online charging system to the first charging keyfor the first user plane function comprises: receiving a quota responsemessage, wherein the quota response message comprises information of thefirst quota granted to the first charging key, and an identifier of thefirst user plane function corresponding to the first quota.
 18. Thesystem according to claim 16, wherein the session management function isfurther configured to: receive quota usage information that correspondsto at least one quota and that is reported by at least one user planefunction of the plurality of user plane functions; and send, to theonline charging system, a charging reporting message generated based onthe quota usage information corresponding to the at least one quota. 19.A network system comprising: a plurality of user plane functions,configured to involve in a protocol data unit (PDU) session, and totransfer data flows in the PDU session; a session management function,configured to determine a data flow associated with each of theplurality of user plane functions involved in the PDU session, and acharging key corresponding to the data flow in the PDU session, to send,to an online charging system, a quota request for a first user planefunction of the plurality of user plane functions, the quota requestrequesting grant of a first quota for a first charging key lacking anavailable quota, with the first charging key corresponding to a firstdata flow associated with the first user plane function of the pluralityof user plane functions, and to receive the first quota granted by theonline charging system to the first charging key for the first userplane function; and the online charging system, configured to receivethe quota request for the first user plane function of the plurality ofuser plane functions, and to send the first quota granted to the firstcharging key lacking the available quota.
 20. The network systemaccording to claim 19, wherein the session management function receivesthe first quota granted by the online charging system to the firstcharging key for the first user plane function comprises: receiving aquota response message, wherein the quota response message comprisesinformation of the first quota granted to the first charging key, and anidentifier of the first user plane function corresponding to the firstquota.